//9
//1 2 1 1 2 1 1 2 1
//这道题真没有特别的解法, 就是求最大前后缀, length - max = x
// lengt/x 为整数, 说明是有x长的串重复构成;  否则输出自身
const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
let n;
let initArr = [];
rl.on("line", (line)=>{
    if(n === undefined) {
        n = Number(line.trim())
    } else {
        initArr = line.trim().split(/\s+/).map(Number)
        getResult(n, initArr)

        // clear
        n = undefined
        initArr.length = 0
    }

})

function getResult(n, initArr) {
    let m = getLongestPreSuf(initArr)
    let k = n - m
    if(n%k === 0) {
        console.log(initArr.slice(0, k).join(" "))
    } else {
        console.log(initArr.join(" "))
    }
}

function getLongestPreSuf(arr) {
    // 求next数组
    let next = new Array(arr.length).fill(0)
    let l = 0
    let r = 1
    while(r < arr.length) {
        if(arr[l] === arr[r]) {
            next[r] = l + 1
            l++
            r++
        } else {
            if(l === 0){
                next[r] = 0
                 r++
            } else {
                l = next[l - 1]
            }
        }
    }
    return next.at(-1)
}
